<template>
	<div>
		<el-cascader ref="cas" @change="handleChange" v-model="value" :options="useIllegal.leaderList" :props="cascaderProps" collapse-tags collapse-tags-tooltip clearable :show-all-levels="false" />3
		<el-button type="primary" @click="handleConfirm">点击</el-button>
	</div>
</template>
<script lang="ts" setup>
import { useIllegalStore } from '@/store/modules/illegal'

const useIllegal = useIllegalStore()
const cascaderProps = { multiple: true }
const value = ref([])
const choosen = ref([])
const handleConfirm = () => {
	console.log(value.value)
	value.value.forEach((item) => {
		choosen.value.push(item[item.length - 1])
	})
	console.log(choosen.value)
}
const cas = ref<any>(null)
const handleChange = () => {
	let obj = cas.value.getCheckedNodes()
	let arr = []
	obj.forEach((item) => {
		if (item.pathLabels.length > 1) arr.push(item.pathLabels)
	})
	console.log(arr)
}
</script>
